% This is to read *_raw.mat to display 2D data for publication
close all
clearvars
clc

MATfile={
    'sph01_scan185_raw.mat';     % bar 2 SPM/KCl/FeCl3 pH 3.0
    'sph02_scan224_raw.mat';     % bar 3
    'sph02_scan406_raw.mat';     % bar 3
    'sph02_scan442_raw.mat';     % bar 2 100 mM KCl + 5mM FeCl3 pH 2
    }

FileSelect=1;

data=load(MATfile{FileSelect});
mon=data.mon;
qz=data.qz;
ct=data.ct;
energy=data.energy;
mca=data.mca;
rng=energy<8.1 & energy>1.9;
% rng=energy>6 & energy< 7.5;
% rng=energy>12;
smear=ones(5,1);
mca_new=convn(mca,smear,'same');
figure;
contour(qz,energy(rng),mca_new(rng,:),[0:10:100], 'LineWidth', 1);
colorbar
set(gca,'ydir','normal');
set(gca,'ytick',[2:1:14]);
set(gca,'ylim',[2 8]);
set(gca,'xlim',[0.01 0.035]);
set(gca,'xtick',[0.01:0.005:0.035]);
set(gca,'fontsize',30);
set(gca,'LineWidth',3);
axis square
%grid on